import { ref } from "vue";

/**
 * useBoolean hook
 * @param {*} initialValue
 * @returns {Array} [boolean, setTrue, setFalse, toggle]
 */
const useBoolean = (initialValue = false) => {
  const boolean = ref(initialValue);
  const setTrue = () => {
    boolean.value = true;
  };
  const setFalse = () => {
    boolean.value = false;
  };
  const toggle = () => {
    boolean.value = !boolean.value;
  };
  return { boolean, setTrue, setFalse, toggle };
};

export { useBoolean };
